package com.gdpu.bo;

import com.gdpu.controller.UmsMemberController;
import com.gdpu.model.UmsMember;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serializable;
import java.util.Collection;

/**
 * @Author:weiming
 * @Date:2021/6/17
 */
@Data
public class UmsMemberDetail implements UserDetails, Serializable {
    private UmsMember umsMember;
    private String password;
    private Boolean enabled;
    private String username;
    private Boolean accountNonExpired;
    private Boolean accountNonLocked;
    private ArrayIndexOutOfBoundsException credentialsNonExpired;

    public UmsMemberDetail(UmsMember umsMember) {
        this.umsMember = umsMember;
    }
    public UmsMemberDetail() {
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }


    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getPassword() {
        return umsMember.getPassword();
    }

    @Override
    public String getUsername() {
        return umsMember.getUserName();
    }


}
